package com.bcxj.apipassenger.controller;

import com.bcxj.apipassenger.Service.OrderInfoService;
import com.bcxj.internalcommon.dto.OrderRequest;
import com.bcxj.internalcommon.dto.ResponseResult;
import com.bcxj.internalcommon.entity.OrderInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: OrderController
 * Package: com.bcxj.apipassenger.controller
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/11/9 14:50
 * @Version 1.0
 * @Since 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderInfoController {

    @Autowired
    private OrderInfoService orderInfoService;

    /**
     * 创建订单/下单
     */
    @PostMapping("add")
    public ResponseResult add(@RequestBody OrderRequest orderRequest) {
        System.out.println(orderRequest);
        return orderInfoService.add(orderRequest);
    }


    /**
     * 乘客取消订单
     * @param orderId
     * @return
     */
    @PostMapping("cancel")
    public ResponseResult cancel(@RequestParam String orderId) {
        return orderInfoService.cancel(orderId);
    }

}
